//package com.peng.my_blog.config;
//
//import org.apache.commons.pool2.impl.GenericObjectPoolConfig;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.data.redis.connection.RedisClusterConfiguration;
//import org.springframework.data.redis.connection.RedisConnectionFactory;
//import org.springframework.data.redis.connection.jedis.JedisConnectionFactory;
//import redis.clients.jedis.HostAndPort;
//import redis.clients.jedis.JedisCluster;
//
//import java.util.HashSet;
//import java.util.Set;
//
//@Configuration
//public class AppConfig {
//
//    /**
//     * Type safe representation of application.properties
//     */
//    @Autowired
//    ClusterConfigurationProperties clusterProperties;
//
////    public @Bean
////    RedisConnectionFactory connectionFactory() {
////        return new JedisConnectionFactory(new RedisClusterConfiguration(clusterProperties.getNodes()));
////
////    }
//@Bean
//public JedisCluster jedisCluster() {
//    Set<HostAndPort> nodes = new HashSet<>();
//    for (String s : clusterProperties.getNodes()) {
//        String[] split = s.split(":");
//        nodes.add(new HostAndPort(split[0],Integer.valueOf(split[1])));
//    }
//    return new JedisCluster(nodes,1000,1000,1 ,new GenericObjectPoolConfig());//需要密码连接的创建对象方式
//}
//}
